<?php
/**
 * Created by PhpStorm.
 * User: 1
 * Date: 2016-10-20
 * Time: 9:30
 */

namespace app\domain;
use app\src\goods\logic\GoodsFeedbackLogic;


/**
 * 照片搜索
 * Class GoodsFeedbackDomain
 * @author hebidu <email:346551990@qq.com>
 * @package app\domain
 */
class GoodsFeedbackDomain extends BaseDomain
{
    /**
     * 照片搜索添加
     * @author hebidu <email:346551990@qq.com>
     */
    public function add(){
        $this->checkVersion("100");
        $img_ids = $this->_post('img_ids','',lang('err_goods_feedback_img_ids_need'));
        $uid     = $this->_post("uid",'',lang("uid_need"));
        $desc    = $this->_post("desc","");
        $contact_addr = $this->_post("contact_addr","");

        $img_arr = explode(",",$img_ids);
        
        if(count($img_arr) > 3){
            $this->apiReturnErr(lang('exceed_limit',['limit'=>3]));
        }

        $entity  = [
            'contact_addr'=>$contact_addr,
            'create_time'=>time(),
            'desc'=>$desc,
            'img_url_list'=>$img_ids,
            'uid'=>$uid,
            'op_status'=>0
        ];
        
        $logic = new GoodsFeedbackLogic();
        
        $result = $logic->add($entity);
        if($result['status'] && intval($result['info']) > 0){
            $this->apiReturnSuc(lang("success"));
        }
        
        $this->exitWhenError($result,true);
    }
    
    
}